<?php
//  防止全局变量造成安全隐患 
include_once('..\\common.php');
include_once('..\\predefine.php');

CheckAdminLogon();

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link href="../css/default.css" rel="stylesheet" type="text/css"/>	

<title>管理</title>
</head>

<body>

<?php
$salerid = $_GET["salerid"];

$DB = DBConnect();

$query = "SELECT name,contact,type,submit_time,fund,demand,charact,devspeed,othersalers,deal_time,deal_money, addict_dev, suppose_saler,product,remark FROM client WHERE id IN (SELECT clientid FROM client_saler_rel WHERE salerid=$salerid AND state ='active' ) ";
//echo $query;
$result = mysql_query($query,$DB);

echo "<table cellspacing='1' cellpadding='1'>
		<tr class='list_head'>
		<td>ID</td>   <td>姓名</td> <td>类型</td> <td>联系方式</td> <td>提交时间</td> <td>回收剩余天数</td> <td>资金量(万元)</td> <td>需求</td> <td>性格</td> <td>所需开发速度</td> <td>其他开发人员</td>  <td>成交时间</td>  <td>成交金额(万)</td> <td>是否还有开发潜力</td> <td>建议谁继续开发</td> <td>预计产品</td> <td>备注</td>
		</tr>";

$index = 0;
while( $myrow = mysql_fetch_row($result) )
{
	$name = $myrow[0];
	$contact=$myrow[1];
	$type= $myrow[2];
	$submit_time = $myrow[3];
	$fund= $myrow[4];
	$demand = ClientNeedList::getItem($myrow[5]);
	$charact = ClientCharaList::getItem($myrow[6]);
	$devspeed = ClientDevSpdList::getItem($myrow[7]);
	$othersalers = $myrow[8];
	$deal_time = $myrow[9];
	$deal_money = $myrow[10];
	$addictd_dev = ($myrow[11]==0)?"否":"是";
	$suppose_saler = $myrow[12];
	$product = $myrow[13];
	$remark = $myrow[14];
	
	$current_day = date("Y-m-d");
	$submit_day = explode(" ",$submit_time);
	$submit_day = $submit_day[0];
	
	$leftday = 20- (strtotime($current_day) - strtotime($submit_day))/(3600*24);
	if($leftday<0)$leftday = "已回收";
	$type= ClientType::getItem($type);
	
	$index = $index+1;
	$classtype= $index%2==0?'list_eve':'list_odd';
	printf("<tr class='$classtype'>
				<td>%d</td>
				<td>%s</td> 
				<td>%s</td>
				<td>%s</td>  
				<td>%s</td>
				<td>%s</td>
				<td>%.2f</td>
				<td>%s</td>
				<td>%s</td>
				<td>%s</td>
				<td>%s</td>
				<td>%s</td>
				<td>%.2f</td>
				<td>%s</td>
				<td>%s</td>
				<td>%s</td>
				<td>%s</td>					
				</tr>\n",
			$index,$name,$type,$contact,$submit_time,$leftday,$fund,$demand,$charact,$devspeed,$othersalers,$deal_time,$deal_money,$addictd_dev,$suppose_saler,$product,$remark
			);
}

echo "</table>";

?>




</body>
</html>